We are using ColdBox 4.3 and are deploying multiple ColdBox applications.
Each application is developed separately with its own Coldbox.cfc config file and its own handlers, models, and views. While they do share some common features, they can not (currently) be run as a single big application run out of the root level of the website.
Our webroot directory looks something like this:
/
/coldbox
/app_1
| Application.cfc
| /coldbox
| /config
| | /Coldbox.cfc
| /handlers
| /models
| {etc}
|
/app_2
| Application.cfc
| /coldbox
| /config
| | /Coldbox.cfc
| /handlers
| /models
| {etc}
|
/app_3
| Application.cfc
{etc}
We have a copy of /coldbox at the root level and a duplicate copy of /coldbox inside each application folder.
If I delete either the root level /coldbox -or- the copy of coldbox inside each application, the application will crash.
How do other developers handle the case of multiple Coldbox applications running on the same webserver???
You need to create a CF mapping that maps /coldbox for each app to wherever ColdBox lives. If all your apps use the same version of ColdBox, then I'd just point them all at the same place. And it doesn't even need to be in the web root. As long as /coldbox resolves to the framework, you'll be fine.
And no another note, if you're on Adobe ColdFusion and hosting more than one app on the same server, you'll want to turn off "Component Cache" in the CF administrator. It will really mess you up.
Related
What is the best way to reset the database along with the migrations.
Here is what I have tried.
Delete all migrations along with deleting all the database tables.
Then running
php bin/console doctrine:mi:diff
php bin/console doctrine:mi:mi
That does not work.
Try running single version at a time like so
php bin/console doctrine:migrations:migrate 'DoctrineMigrations\Version20200722104913'
I tried this:
php bin/console doctrine:database:drop --force
php bin/console doctrine:database:create
php bin/console doctrine:mi:mi
The Problem (in detail):
Everything I do leads me to the same result.
Doctrine thinks that I still have some tables to generate which are long gone (Not in the Enitity anymore)
That's why I have this error:
An exception occurred while executing 'DROP TABLE
greetings_card_category':
SQLSTATE[42S02]: Base table or view not found: 1051 Unknown table
'symfony.greetings_card_category'
I also get this warning
[WARNING] You have 6 previously executed migrations in the database that are not registered migrations.
In my migrations Directory I only have two migrations:
Version20200722104913.php
Version20200722143619.php
Here is the status if it somehow helps.
bin/console do:mi:status
| Versions | Previous | DoctrineMigrations\Version20200717093052 |
| | Current | DoctrineMigrations\Version20200722150530 |
| | Next | DoctrineMigrations\Version20200722104913 |
| | Latest | DoctrineMigrations\Version20200722143619 |
|--------------------------------------------------------------------------------------------------------
| Migrations | Executed | 6 |
| | Executed Unavailable | 6 |
| | Available | 2 |
| | New | 2
At this point I would really just love to have 1 clean database and 1 migration.
How to achieve this?
Be aware that having one migration script isn't the best way, if you work in a team or if application was already deployed. But, in the case that you are the only one developer or if you want to rebase some commit, you can do it.
If you really want to have only one migration script, here is a solution. But first of all, it is always a bad idea to drop data and table manually because of the migration_table that is used by doctrine. This table contains data used by doctrine to know the current state of your database. So, you drop tables manually, your database will be unsynchronized with the migration table, and your scripts will failed. To avoid your current error, you now have to truncate the migration_table. If it isn't enough, drop migration table, if it isn't enough drop and create the database (for the last time, because below is a solution to avoid this kind of mismatch.
Step1: Downgrade your database via doctrine:migrate
php bin/console doctrine:migrations:migrate first -n
At this step your database is empty. (The tips is the keyword "first")
Step2: Delete (after a backup) all files in the migration directory
Step3: Create a new migration
php bin/console make:migration
(or you can use symfony console doctrine:migrations:diff if you do not use the make-bundle)
Step4: Verify and manually edit the file created if necessary.
Step5: Upgrade your database
php bin/console doctrine:migration:migrate -n
Having one migration it isn't the best way, especially when you work in a team and do some features in different branches. With the one migration, it is easy to mess up and do something wrong like in your case. So it's ok to have many migrations.
What about your error, you can manually edit your migration and fix all errors, then run diff and migrate(if needed), or you can drop your database, remove all migrations and create a new one, and then creates migrations after making changes in code.
I have an app written in Go, which I attempted to deploy to EB.
When trying to access it, I get an Error 502 from nginx, presumably because the app is not running.
Looking at logs, I get a lot of errors like
14:01:29 build.1 | application.go:10:2: cannot find package "github.com/aws/aws-sdk-go/aws" in any of:
14:01:29 build.1 | /opt/elasticbeanstalk/lib/go/src/github.com/aws/aws-sdk-go/aws (from $GOROOT)
14:01:29 build.1 | /var/app/current/src/github.com/aws/aws-sdk-go/aws (from $GOPATH)
Despite the fact, that I have all of my dependencies included in the application bundle under a vendor subdirectory. How come EB does not use vendoring? According to the dashboard, it is running Go 1.9, so vendoring should be supported.
You need to set your GOPATH in your EBS to the root of your project directory, assuming there is a src directory where your vendor directory is located.
For instance, pretend this is your project structure:
app/
src/
vendor/
And pretend that project is located in ~/home, which makes its location ~/home/app.
Then your GOPATH should be set to ~/home/app. Go will attempt to access the dependencies through $GOPATH/src/vendor.
But if this were the kind of structure you were using before, then you would need to have your GOPATH updated during local development as well, so if you aren't already doing that then I imagine you're using a different kind of setup... this solution, however, will work as long as your project is structured as I described above.
I am currently working on a UI project for my team. After building a project on Jenkins, we want to trigger acceptance tests to run. On my local machine, I am able to do so by activating a server.py with the command:
python server.py
After the server is up and running, I can run the acceptance test folder that I have written with the command:
pybot acceptance_tests
I am now trying to migrate my tests from my local machine to Jenkins. What I cannot figure out is how I am able to run the server (server.py) on Jenkins. I am relatively new to Jenkins, so any details will be great!
Instead of starting the server via jenkins, have the test start and stop the server. This will give you the same behavior regardless of how you run your tests (ie: via jenkins for manually from the command line).
Robot has a library named Process which you can use for starting and stopping processes. You can use the Start Process and Terminate Process keywords to start and stop the webserver via a suite setup and suite teardown. It would look something like this:
*** Settings ***
| Library | Process
| Suite Setup | Start the webserver
| Suite Teardown | Stop the webserver
*** Keywords ***
| Start the webserver
| | ${server process}= | Start process | python | server.py
| | Set suite variable | ${server process}
| Stop the webserver
| | Terminate Process | ${server process}
Of course, you'll want to add some bullet proofing such as making sure the server actually starts, and possibly catching errors if it doesn't exit cleanly. You may need to give an explicit path to server.py, but hopefully this gives the general idea.
I have added the external jar I want to {jetty.home}/lib/ext but when I rebuild my war file without this jar, deploy it, and restart the web service, it isn't able to find the jar and I'm getting:
java.lang.NoClassDefFoundError
I'm not sure I'm headed down the right path, but essentially I would like to remove a jar from the war file of multiple web services, and have them all reference the jar via classpath (so that it can be easily updated without rebuilding and deploying the war file.
I've tried in /lib/ext, /lib/, and /resources.
[root]$ java -jar start.jar --version
Active Options: [Server, jmx, resources, websocket]
Version Information on 15 entries in the classpath.
Note: order presented here is how they would appear on the classpath.
changes to the OPTIONS=[option,option,...] command line option will be reflected here.
0: 7.0.1.v20091125 | ${jetty.home}/lib/jetty-xml-7.0.1.v20091125.jar
1: 2.5.0.v200806031605 | ${jetty.home}/lib/servlet-api-2.5.jar
2: 7.0.1.v20091125 | ${jetty.home}/lib/jetty-http-7.0.1.v20091125.jar
3: 7.0.1.v20091125 | ${jetty.home}/lib/jetty-continuation-7.0.1.v20091125.jar
4: 7.0.1.v20091125 | ${jetty.home}/lib/jetty-server-7.0.1.v20091125.jar
5: 7.0.1.v20091125 | ${jetty.home}/lib/jetty-security-7.0.1.v20091125.jar
6: 7.0.1.v20091125 | ${jetty.home}/lib/jetty-servlet-7.0.1.v20091125.jar
7: 7.0.1.v20091125 | ${jetty.home}/lib/jetty-webapp-7.0.1.v20091125.jar
8: 7.0.1.v20091125 | ${jetty.home}/lib/jetty-deploy-7.0.1.v20091125.jar
9: 7.0.1.v20091125 | ${jetty.home}/lib/jetty-servlets-7.0.1.v20091125.jar
10: 7.0.1.v20091125 | ${jetty.home}/lib/jetty-jmx-7.0.1.v20091125.jar
11: (dir) | ${jetty.home}/resources
12: 7.0.1.v20091125 | ${jetty.home}/lib/jetty-websocket-7.0.1.v20091125.jar
13: 7.0.1.v20091125 | ${jetty.home}/lib/jetty-util-7.0.1.v20091125.jar
14: 7.0.1.v20091125 | ${jetty.home}/lib/jetty-io-7.0.1.v20091125.jar
Jetty 7.0.1 is very old now. Consider upgrading. (9.2.5.v20141112 is the current stable version)
Alright, back to your issue. You don't have the ext option enabled.
Edit your ${jetty.home}/start.ini and add ext to the end of the line that starts with OPTIONS=
Know that all this does is makes any jars that you put there present on the server classpath, suitable for the server to use for things like JNDI resources (such as database DataSource references).
The mere existence of a jar in ${jetty.home}/lib/ext does not mean its accessible by your webapps. The WebApp ClassLoader isolation (a servlet spec requirement) prevents this.
But all is not lost, Jetty provides means to configure the WebApp ClassLoader to "poke holes" into this isolation layer, allowing for control over individual classes and/or entire package namespaces behavior.
This is done by setting up and configuring the WebAppContext in a Jetty Context XML in your ${jetty.home}/webapps/ directory.
You'll have 2 things you can configure.
addSystemClass(String)
This is a class (or package) that cannot be replaced by the web application, and they are always loaded via the system classloader
addServerClass(String)
These are classes that are hidden from being loaded by the web application using the system classloader, so if a webapplication needs to load any of such classes, it has to include them in its distribution.
So, lets say you add a file called ${jetty.home}/lib/ext/corpcommon.jar, and it has a package namespace of com.corp.common, your resulting XML files will contain following snippets
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
...
<!-- webapp cannot override these, use the server version always,
even if the webapp has its own copy -->
<Call name="addSystemClass">
<Arg>com.corp.common.</Arg>
</Call>
<!-- expose com.corp.common to webapp -->
<Call name="addServerClass">
<Arg>-com.corp.common.</Arg>
</Call>
I use Yeoman to build Ember applications.
I want to duplicate an application (changing the directory and application name (which means changing the name in all Ember views, controllers, etc.).
At the moment I'm doing everything manually, is there a better way of doing this?
There is no built-in tool in Yeoman, but if your app name is unique, you can just replace it in all your files by running something like this:
git ls-files | egrep '\.(js|html)$' | xargs sed -i s/OldAppName/NewAppName/g